package com.hsq.db137.demos.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: hsq加油
 * @CreateTime: 2024/12/25-9:29
 * @Description: TODO
 * @Version: 1.0
 */
@Component
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R {
    private int code = 200;
    private String message = "成功";
    private Map<String, Object> data=new HashMap<>();

    public String getMessage() {
        return message;
    }

    public R setMessage(String message) {
        this.message = message;
        return this;
    }

    public int getCode() {
        return code;
    }

        public R setCode(int code) {
        this.code = code;
        return this;
    }

    //链式调用
    public R add(String key, Object value) {
        this.data.put(key, value);
        return this;
    }
}

